package cc.lj.internal.merchant.infrastructure.repository.mysql;

import cc.lj.internal.core.exception.ServiceException;
import cc.lj.internal.core.model.BasePageHelper;
import cc.lj.internal.merchant.domain.contract.repository.IMerchantContractSignedRepository;
import cc.lj.internal.merchant.domain.contract.repository.IProperyResourcesRepository;
import cc.lj.internal.merchant.infrastructure.dao.IMerchantContractSignedMapper;
import cc.lj.internal.merchant.infrastructure.dao.IPropertyResourcesMapper;
import cc.lj.internal.merchant.infrastructure.exception.MerchantExceptionEnum;
import cc.lj.internal.merchant.infrastructure.po.MerchantContractSignedPO;
import cc.lj.internal.merchant.infrastructure.po.PropertyResourcesPO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 商户合同签订表　Mysql仓储实现
 * @author liangxifeng
 * @date 2021-12-24
 */
@Repository("merchantContractSignedMysqlRespository")
public class MerchantContractSignedMysqlRespository implements IMerchantContractSignedRepository, BasePageHelper<MerchantContractSignedPO> {
    @Autowired
    private IMerchantContractSignedMapper contractSignedMapper;


    @Override
    public List<MerchantContractSignedPO> list(MerchantContractSignedPO param) {
        QueryWrapper<MerchantContractSignedPO> wrapper = new QueryWrapper<>(param);
        List<MerchantContractSignedPO> entitys = contractSignedMapper.selectList(wrapper);
        if(entitys == null)
        {
            throw new ServiceException(MerchantExceptionEnum.MERCHANT_CONTRACT_SIGNED_LIST_NULL);
        }
        return entitys;
    }

    @Override
    public List<MerchantContractSignedPO> getList(MerchantContractSignedPO entityPO) {
        return list(entityPO);
    }
}
